<html>
<head>
<script>
function endTest() {
    window.opener.log("PASS.");
    window.opener.finish();
}

function loadNext() {
    if (window.opener.canExit2) {
        endTest();
        return;
    }

    window.opener.log("page-1, about to navigate to page-2.")
    // Location changes need to happen outside the onload handler to generate history entries.
    setTimeout(function() {location.href = "cached-page-2.html";}, 0);
}

// This unload handler exists just to make sure this page is not added
// to the page cache!
function myUnload() {
    window.opener.log("page-1 running unload handler");
}
</script>
</head>
<body onload="loadNext()" onunload="myUnload()">
</body>
</html>
